<?php

use yii\helpers\Html;
use yii\helpers\Url;
use yii\bootstrap\Modal;
/**
 * @var yii\web\View $this
 * @var common\models\Post $model
 */

$this->title = 'Create Post';
$this->params['breadcrumbs'][] = ['label' => 'Posts', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;


echo Html::a('创建', '#', [
'id' => 'create',
'data-toggle' => 'modal',
'data-target' => '#create-modal',
'class' => 'btn btn-success',
]);
?>
<?php
Modal::begin([
'id' => 'create-modal',
'header' => '<h4 class="modal-title">创建sqweqweqwew</h4>',
'footer' => '<a href="#" class="btn btn-primary" data-dismiss="modal">Close</a>',
]);
$requestUrl = Url::toRoute('create');
$js = <<<JS
$.get('{$requestUrl}', {},
function (data) {
$('.modal-body').html(data);
}
);
JS;
$this->registerJs($js);
Modal::end();
?>

<!--引入模态对话框 -->
<?php
// \yii\bootstrap\Modal::begin([
//     'header' => '<h2>Branches</h2>',
//     'id'=>'modal',
//     'size'=>'modal-lg',
// ]);
// echo '<div id="modalContent"> </div>';
//
// \yii\bootstrap\Modal::end()
?>
<div class="post-create">

    <h1><?= Html::encode($this->title) ?></h1>

    <?= $this->render('_form', [
        'model' => $model,
    ]) ?>

</div>
